package com.bckj.fastboot.upms.api.dto;

import com.bckj.fastboot.upms.api.entity.SysMenu;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * TreeSelect树结构实体类
 * 
 * @author ruoyi
 */
@Data
@Accessors(chain = true)
public class TreeSelect implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private Long id;

    /** 节点名称 */
    private String label;

    /** icon */
    private String icon;

    /** menuimg */
    private String img;

    /** 路由地址 **/
    private String routerPath;

    /** 组件地址  **/
    private String component;

    /** 类型（M目录 C菜单 F按钮）**/
    private String menuType;

    /** 权限字符 **/
    private String perms;

    /** 排序 **/
    private Integer sort;
    //父类0 子类其他
    private Long parentId;

    private Boolean selected = false;

    private String value;

    private String redirect;

    private String activeMenu;

    private Long menuId;

    private String appName;

    private Integer status;

    /** 子节点 */
    private List<TreeSelect> children;

    public TreeSelect() {}

    public TreeSelect(SysMenu menu) {
        this.id = menu.getId();
        this.label = menu.getMenuName();
        this.parentId = menu.getParentId();
        this.icon = menu.getIcon();
        this.img = menu.getMenuImg();
        this.routerPath = menu.getRouterPath();
        this.component = menu.getComponent();
        this.menuType = menu.getMenuType();
        this.perms = menu.getPerms();
        this.sort = menu.getSort();
        this.value = menu.getKeyIndex() + "-" + menu.getBitLocation();
        this.redirect = menu.getRedirect();
        this.activeMenu = menu.getActiveMenu();
        this.status = menu.getStatus();
    }

}
